package com.yixun.qfbao.api.service.impl;

import com.yixun.qfbao.api.service.WeAppFormIdService;
import com.yixun.qfbao.apidto.AddWeAppFormIdReqDto;
import com.yixun.qfbao.apidto.AddWeAppFormIdResDto;
import com.yixun.qfbao.model.dto.WeappFormidDto;
import com.yixun.qfbao.model.enums.DelFlagEnum;
import com.yixun.qfbao.model.enums.IsUsedEnum;
import com.yixun.qfbao.service.WeappFormidService;
import com.yixun.qfbao.xf.model.enums.ResultEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class WeAppFormIdServiceImpl implements WeAppFormIdService {

    private static final Logger logger = LoggerFactory.getLogger(WeAppFormIdServiceImpl.class);

    @Autowired
    private WeappFormidService weappFormidService;

    @Override
    public AddWeAppFormIdResDto addFormId(AddWeAppFormIdReqDto reqDto) {
        AddWeAppFormIdResDto resDto = new AddWeAppFormIdResDto();
        WeappFormidDto dto = new WeappFormidDto();
        dto.setUserId(reqDto.getUserId());
        dto.setUserType(reqDto.getUserType());
        dto.setFormId(reqDto.getFormId());
        dto.setDelFlag(DelFlagEnum.UNDEL.getNo());
        dto.setIsUsed(IsUsedEnum.UNUSED.getNo());
        weappFormidService.create(dto);
        resDto.setResult(ResultEnum.SUCCESS.getNo());
        return resDto;
    }
}
